package csc.daonjpa.java.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

/**
 * Entity class for Account table. This is a simple POJO class with annotations to define mapping with DB table
 * @author nvu3
 *
 */
@Entity
@Table(name="account")
@PrimaryKeyJoinColumn(name="accountNumber")
public class Account extends BaseInfo implements Serializable {
	private static final long serialVersionUID = 1L;
	
	
	@Column(name = "accountName")
	private String accountName;
	
	@Column(name = "accountType")
	private String accountType;
	@Column(name = "loginId")
	private String loginId;
	@ManyToOne(optional = false)
	@JoinColumn(name="loginId",referencedColumnName="loginId", insertable=false, updatable=false)
	private Customer customer;
	/**
	 * Required constructor
	 */
	public Account() {
	
	}
	
	/**
	 * Other constructor, you can define as many constructors as you want, but the constructor without parameters is required
	 * @param accountNumber
	 * @param accountName
	 * @param accountType
	 */
	public Account(String number, double availableAmount, String accountName,
			String accountType,String loginId) {
		super(number, availableAmount);
		this.accountName = accountName;
		this.accountType = accountType;
		this.loginId = loginId;
	}

	/**
	 * @return AccountName
	 */
	public String getAccountName() {
		return this.accountName;
	}

	/**
	 * Set accountName
	 * @param accountName
	 */
	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	/**
	 * @return AccountType
	 */
	public String getAccountType() {
		return this.accountType;
	}

	/**
	 * Set accountType
	 * @param accountType
	 */
	public void setAccountType(String accountType) {
		this.accountType = accountType;
	}
}